#ifndef ENGINE_H
#define ENGINE_H

#include <QString>
#include <QVariantMap>
#include <QXmlDefaultHandler>

#include "../enginelogger.h"
#include "../earthdawn.h"
#include "../character.h"
#include "../skill.h"
#include "../talent.h"

class Engine
{
public:
  Engine();
  virtual ~Engine();
  Character* create(const QVariantMap& args);
  QString log() const;

protected:
  Character* _character;
  EngineLogger _log;

  virtual void init(const QVariantMap &args)=0;
  virtual void start()=0;
  virtual void reset()=0;
};

#define __ENGINE_CHECKARG__(NAME,VAR,CONVERSION)\
  if (!args.contains(NAME)) VAR = NAME##_DEFAULT;\
  else VAR = args[NAME].to##CONVERSION();

#endif // ENGINE_H
